#include <Gal.h>
#include <stdio.h>
#include <stdlib.h>
#include <xf86drm.h>
#include "Private.h"
#include "NvDMA.h"

/// <summary>
/// TODO
/// </summary>
int inline NVInitDma(DriverPtr drv)
{
	if (drv == NULL)
		return -1;

	NV50PrivatePtr p = NV_PRIVATE(drv);
	if (nouveau_channel_alloc(p->device, NV_DmaFB, NV_DmaTT, &p->channel))
		return -1;

	return 0;
}

/// <summary>
/// TODO
/// </summary>
int inline NVExitDma(DriverPtr drv)
{
	if (drv == NULL)
		return -1;

	NV50PrivatePtr p = NV_PRIVATE(drv);
	nouveau_channel_free(&p->channel);

	return 0;
}
